package com.shenzhenai.composebasic.components

import androidx.compose.material3.Switch
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.tooling.preview.Preview

/**
 * @author huangzehui
 * @date 2025/9/12 13:41 周五
 * @description
 *
 * Switch 用法
 * https://www.bilibili.com/video/BV1N44y1n7TR?vd_source=e07cc8cc94eb22bd76722071b03cd199&spm_id_from=333.788.videopod.sections
 *
 */

@Composable
fun SwitchSample() {
    var checked by remember {
        mutableStateOf(false)
    }

    Switch(checked=checked, onCheckedChange = {
        checked = it
    })
}

@Preview
@Composable
fun SwitchSamplePreview() {
    SwitchSample()
}
